package com.xyht.sca_s.student_manage_system.modules.rxRegistrationAdvance.util;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xyht.sca_s.student_manage_system.modules.rxRegistration.entity.RxRegistrationPlanSetting;
import com.xyht.sca_s.student_manage_system.modules.rxRegistration.mapper.*;
import com.xyht.sca_s.student_manage_system.modules.rxRegistrationAdvance.mapper.RxRegistrationAdvanceStudentInfoMapper;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

import static com.xyht.sca_s.student_manage_system.modules.rxRegistration.constant.PlanStatusConstant.PLAN_STATUS_ENABLE;

@Component
public class PlanUtil {

    @Resource
    private RxRegistrationAdvanceStudentInfoMapper rxRegistrationAdvanceStudentInfoMapper;
    @Resource
    private RxRegistrationPlanAppSettingMapper rxRegistrationPlanAppSettingMapper;
    @Resource
    private RxRegistrationPlanChargeCategorySettingMapper rxRegistrationPlanChargeCategorySettingMapper;
    @Resource
    private RxRegistrationPlanSettingMapper rxRegistrationPlanSettingMapper;
    @Resource
    private RxRegistrationChargeCategoryDetailMapper rxRegistrationChargeCategoryDetailMapper;
    @Resource
    private RxRegistrationChargeCategoryMapper rxRegistrationChargeCategoryMapper;
    @Resource
    private RxRegistrationCustomColumnMapper rxRegistrationCustomColumnMapper;
    @Resource
    private RxRegistrationCustomColumnValueMapper rxRegistrationCustomColumnValueMapper;

    /**
     *
     * @return 获取计划信息
     */

    public RxRegistrationPlanSetting getEnablePlanInfo() {

        List<RxRegistrationPlanSetting> rxRegistrationPlanSettingList = rxRegistrationPlanSettingMapper.selectList(new LambdaQueryWrapper<RxRegistrationPlanSetting>()
                .eq(RxRegistrationPlanSetting::getPlanStatus, PLAN_STATUS_ENABLE));
        if (rxRegistrationPlanSettingList == null || rxRegistrationPlanSettingList.size() == 0) {
            return null;
        }
        return rxRegistrationPlanSettingList.get(0);
    }

}
